package mrh.niubi.librarysystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import mrh.niubi.librarysystem.pojo.Book;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mapstruct.Mapper;

import java.util.List;


@Mapper
public interface BookMapper extends BaseMapper<Book> {

    List<Book> selectBooksByQueryinf(@Param("inf") String queryinf);

    Book selectBookById(@Param("id") int id);

    @Update("update book set num = num - #{num} where id = #{id}")
    int subNum(Integer id,Long num);

    @Update("update book set num = num + #{num} where id = #{id}")
    int addNum(Integer id, Long num);

}
